import request from '@/utils/request'

export function getGroup() {
  return request({
    url: '/v1/group/findGroup',
    method: 'get'
  })
}

export function findGroupByPage(data, pageNum, pageSize) {
  return request({
    url: '/v1/group/findGroupByPage',
    method: 'get',
    params: {
      groupName: data.groupName,
      pageNum: pageNum,
      pageSize: pageSize
    }
  })
}

export function add(data) {
  return request({
    url: '/v1/group/add',
    method: 'post',
    data: {
      groupName: data.groupName,
      groupLeader: data.groupLeader,
      membersList: data.choseMember
    }
  })
}

export function edit(data) {
  return request({
    url: '/v1/group/edit',
    method: 'put',
    data: {
      groupId: data.groupId,
      groupName: data.groupName,
      groupLeader: data.groupLeader,
      membersList: data.choseMember
    }
  })
}

export function active(groupId) {
  return request({
    url: '/v1/group/active/' + groupId,
    method: 'put'
  })
}

export function remove(groupId) {
  return request({
    url: '/v1/group/remove/' + groupId,
    method: 'delete'
  })
}
